package com.yjy.user;

import com.yjy.redis.RedisKey;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class UserTest {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    private String setUserKey(String key) {
        return RedisKey.USER_KEY_PREFIX + key;
    }

    @Test
    public void testAddString() {
        redisTemplate.opsForValue().set("testString", "testString");
    }

    @Test
    public void testGetString() {
        String str = (String) redisTemplate.opsForValue().get("testString");
        System.out.println(str);
    }
}
